home *** CD-ROM | disk | FTP | other *** search
/ QRZ! Ham Radio 8 / QRZ Ham Radio Callsign Database - Volume 8.iso / pc / files / dsp / 56000tar.z / 56000tar / 56000 / speech / adpcmns.hlp < prev    next >
Text File  |  1991-11-26  |  10KB  |  205 lines

  1.          Name: ADPCMNS
  2.          Type: Assembler Program
  3.       Version: 1.0
  4.  Date Entered: 8/9/90
  5.   Last Change: 8/9/90
  6.  
  7. Description: Nonstandard CCITT ADPCM Speech Compression
  8.  
  9.  
  10. General Information:
  11.  
  12. The file ADPCMNS.ASM contains the source code for the nonstandard 
  13. implementation of the CCITT 32-kbit/s ADPCM speech coding algorithm on
  14. the DSP56001. Associated with this program is the file ADPCM.ASM which
  15. contains the source code for the standard version of the same algorithm.
  16. This help file contains usage notes for the nonstandard implementation.
  17. Refer to the help file ADPCM.ASM for usage notes on the standard implemen-
  18. tation. Complete documentation for both versions can be found in the
  19. Motorola application report "Full-Duplex 32-kbit/s CCITT ADPCM Speech
  20. Coding on the Motorola DSP56001" available as document APR9/D from the
  21. Motorola Literature Distribution Center.
  22.  
  23. The program ADPCMNS.ASM implements the algorithm defined in CCITT
  24. Recommendation G.721: "32 kbit/s Adaptive Differential Pulse Code
  25. Modulation" dated August 1986. This version of the implementation does
  26. not adhere to the complete specification. It does provide a more direct
  27. and efficient implementation of algorithm and produces comparable
  28. quality to the standard version.
  29.  
  30. The source code in ADPCMNS.ASM contains the necessary code for a real-
  31. time I/O interface. The details of this interface are described below.
  32. As with the standard version the I/O interface can easily be modified
  33. for other configurations. This code has been tested with a real-time
  34. hardware platform and is believed to have overall output quality similar
  35. to the standard code. Exhaustive tests have not been performed, however,
  36. so the actual performance under all conditions can not be assured in
  37. all cases. It is the responsibility of the user to verify correct
  38. operation.
  39.  
  40.  
  41. Usage Notes:
  42.  
  43. The source code in the file ADPCMNS.ASM is set up to run the ADPCM
  44. algorithm in a real-time, full-duplex mode. The I/O interface of
  45. the code was chosen primarily for a convenient hardware test platform.
  46. A diagram is shown below. The test setup basically consists of two
  47. DSP56000ADS systems connected to a codec interface board. This board
  48. has two Motorola MC145503 codecs that provide the PCM interface.
  49. Each ADS board is connected to one of the MC145503 codecs via the J5
  50. or J3 connectors which connect to the SSI port of the DSP56001. A
  51. simplified diagram of this interface is shown below. Complete details
  52. of the codec circuit can be found in the MC145503 data sheet. Many
  53. other codecs have a very similar interface to the DSP56001 SSI port.
  54. Eight port B general purpose I/O pins are used for the ADPCM link.
  55. Pins PB0 through PB3 are used as outputs and pins PB4 though PB7 are
  56. used as inputs. These pins are connected between the two ADS boards
  57. by connecting the appropriate lines on the 96-pin J3 connector on the
  58. ADS boards.
  59.  
  60. The clocks for the two codecs are provided by a common clock source
  61. on the codec board. Each ADS board synchronizes the input and output
  62. based on the SSI port. Since the SSI interfaces on both boards are
  63. derived from a common clock, the entire system is synchronized. The
  64. initialization of the SSI port is done in the INIT routine. The SSI
  65. is set for synchronous, normal mode with 8 bit words, continuous exter-
  66. nal clock, and word length external frame sync. The I/O is synchronized
  67. by polling the SSI receive data register full flag (RDF), bit 7 in the
  68. SSI status register. When this flag is set, the program reads in the
  69. new PCM word for the ADPCM encoder, and outputs the ADPCM decoder output
  70. for the next SSI transmit slot. The encoder outputs the four bit ADPCM
  71. value to port B pins PB0 through PB3 by writing to the port B data
  72. register (PBD). The decoder reads in the encoded ADPCM word from port
  73. B pins PB4 through PB7 by reading the PBD register.
  74.  
  75.  
  76.  
  77.             CODEC 1                ADS 1
  78.            --------             -----------  
  79. Analog In |        |           |           | ADPCM Channel
  80.    ------>|        |    PCM    |      PB4.7|/-----------+
  81.           |        |/---------\|SSI        |\---------+ |
  82. Analog Out|        |\---------/|           |          | |
  83.    <------|        |  Channel  |      PB0.3|-------+  | |
  84.           |        |           |           |-----+ |  | |
  85.            --------             -----------      | |  | |
  86.                ^                                 | |  | |
  87.                |                                 | |  | |
  88.    Clock ------+                                 | |  | |
  89.                |                                 | |  | |
  90.                v                                 | |  | |
  91.            --------             -----------      | |  | |
  92. Analog In |        |           |           |/----+ |  | |
  93.    ------>|        |    PCM    |      PB4.7|\------+  | |
  94.           |        |/---------\|SSI        |          | |
  95. Analog Out|        |\---------/|           |----------+ |
  96.    <------|        |  Channel  |      PB0.3|------------+
  97.           |        |           |           | ADPCM Channel
  98.            --------             -----------
  99.             CODEC 2                ADS 2
  100.  
  101.          Block diagram of real-time test platform
  102.  
  103.  
  104.  
  105.                           2.048 MHz
  106.                               |
  107.                               |  8 kHz
  108.            MC145503           |   |        DSP56001
  109.            --------           |   |       ----------
  110.           |    RDC |<---      |   |      |          |
  111.           |        |    |     |   |      |       PB0|----->
  112. Analog In |    TDC |<---+-----+--------->|SCK     . |  .
  113.    ------>|        |              |      |        . |  .
  114.           |    RDE |<---          |      |       PB3|----->
  115. Analog Out|        |    |         |      |          |
  116.    <------|    TDE |<---+---------+----->|SC2    PB4|<-----
  117.           |        |                     |        . |  .
  118.           |    RDD |<--------------------|STD     . |  .
  119.           |        |                     |       PB7|<-----
  120.           |    TDD |-------------------->|SRD       |
  121.            --------                       ----------
  122.  
  123.                    DSP56001/MC145503 Interface
  124.  
  125.  
  126. Although the CCITT defines the ADPCM specification for conversion of PCM
  127. data to encoded ADPCM data, the algorithm itself operates on linear
  128. input data. This code has also been tested with 16-bit linear data from
  129. 16-bit A/D's and D/A's. In this case the PCM conversion routines EXPAND
  130. and COMPRESS were removed. The output data required a two bit left shift
  131. since this shift was included in the COMPRESS routine.
  132.  
  133.  
  134. Memory Usage:
  135.  
  136.                            Program     Data
  137.                Internal      479        70 (X)
  138.                                         72 (Y)
  139.                External      132
  140.                --------      ---       ---
  141.                   Total      611       142
  142.  
  143. The program uses only internal X and Y memory so no external data memory
  144. is required. Most of the 132 words of external program memory that is
  145. required is taken up by the INIT routine and the load-time constant table
  146. storage. The remaining words are part of the COMPRESS routine. Most
  147. applications will not require simultaneous use of both mu-law and A-law
  148. compression. If either the mu-law or A-law portion of the COMPRESS routine
  149. is removed then the entire run-time portion of the nonstandard code
  150. will reside in internal memory. If a host processor is attached to the
  151. DSP56001 then no external memory will be required. Otherwise, slower
  152. memories can be used during the initialization process.
  153.  
  154.  
  155. Performance Summary:
  156.  
  157. The following shows the order of execution of the routines and the worst
  158. case processing time (in instruction cycles) for each routine. A routine
  159. defined as the code between commented sections even though some processing
  160. for that function may not be included in this code. Note that an instruc-
  161. tion cycle is defined as two clock cycles on the DSP56001.
  162.  
  163.       Encoder                            Decoder
  164.  
  165. FMULT (x8)                         FMULT (x8)
  166. ACCUM           14                 ACCUM           14
  167. LIMA             4                 LIMA             4
  168. MIX              9                 MIX              9
  169. EXPAND          14                 RECONST         10
  170. SUBTA            2                 ADDA             1
  171. LOG             28                 ANTILOG         28
  172. SUBTB            1                 TRANS           32
  173. QUAN            41                 ADDB             6
  174. RECONST         10                 ADDC            11
  175. ADDA             1                 XOR
  176. ANTILOG         28                 UPB (x8)        72
  177. TRANS           32                 UPA2            25
  178. ADDB             6                 LIMC             5
  179. ADDC            11                 UPA1            14
  180. XOR                                LIMD             8
  181. UPB (x8)        72                 FLOATA           7
  182. UPA2            25                 FLOATB           1
  183. LIMC             5                 TONE             3
  184. UPA1            14                 TRIGB           15
  185. LIMD             8                 FUNCTF           5
  186. FLOATA           7                 FILTA            4
  187. FLOATB           1                 FILTB            3
  188. TONE             3                 SUBTC           11
  189. TRIGB           15                 FILTC            3
  190. FUNCTF           5                 TRIGA            3
  191. FILTA            4                 FUNCTW           5
  192. FILTB            3                 FILTD            4
  193. SUBTC           11                 LIMB             7
  194. FILTC            3                 FILTE            4
  195. TRIGA            3                 COMPRESS        39
  196. FUNCTW           5                 EXPAND
  197. FILTD            4                 SUBTA
  198. LIMB             7                 LOG
  199. FILTE            4                 SUBTB
  200. misc.          116                 SYNC
  201.                                    misc.          117
  202. -------------------                -------------------
  203. TOTAL          513  Icycles        TOTAL          471  Icycles
  204.  
  205.